
from core import data_dir
from pathlib import Path
from typing import Union


def load_text(text_file: Union[Path, str]):
    """加载文本内容"""
    text_file = Path(text_file)
    if not text_file.exists():
        text_file = data_dir / 'contracts' / text_file
    if not text_file.exists():
        return None
    with open(text_file, 'r', encoding='utf-8') as fs:
        return fs.read()
